package com.ctg.itrdc.sysmgr.portal.data.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.ctg.itrdc.pasp.data.dao.BaseDao;
import com.ctg.itrdc.sysmgr.portal.data.IFuncCompDao;
import com.ctg.itrdc.sysmgr.portal.data.entity.FuncComp;
import com.ctg.itrdc.sysmgr.portal.data.vo.FuncCompVO;

@Component("funcCompDao")
public class FuncCompDaoImpl extends BaseDao<FuncComp, Long> implements IFuncCompDao {

	public List<FuncCompVO> selectByIds(GrantSysobjType sysobjType,FuncComp funcComp ,Long ...ids) {
		List<Long> idList = new ArrayList<Long>();
		for(Long id : ids) {
			idList.add(id);
		}
		Map<String,Object> model = new HashMap<String,Object>(4);
		model.put("sysobjType", sysobjType);
		model.put("funcComp", funcComp);
		model.put("idList", idList);
		model.put("privRefType", PrivRefType.COMP);
		return super.queryBySqlId("selectByIds", FuncCompVO.class, model, null);
	}
	
	public Boolean exist(GrantSysobjType sysobjType,FuncComp funcComp ,Long ...ids){
		List<Long> idList = new ArrayList<Long>();
		for(Long id : ids) {
			idList.add(id);
		}
		Map<String,Object> model = new HashMap<String,Object>(4);
		model.put("sysobjType", sysobjType);
		model.put("funcComp", funcComp);
		model.put("idList", idList);
		model.put("privRefType", PrivRefType.COMP);
		String sql = super.getSqlStatment("selectByIds", model);
		
		long i = super.jdbcGetSize(sql, null);
		return i>0;
	}
}